<?php
/**
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_2
 * @license    GNU/GPL
*/
 
// No direct access
 
defined( '_JEXEC' ) or die( 'Restricted access' );
 
jimport( 'joomla.application.component.view');
 
/**
 * HTML View class for the JobsWorld Component
 *
 * @package    JobsWorld
 */
 
class JobsViewNewsletter extends JView
{
    function display($tpl = null)
    {
		global $mainframe, $option;
       // $model = &$this->getModel();
		$user = JFactory::getUser();
			
		$email =  JRequest::getVar( 'email','','get' );  
		$emaildisable =  JRequest::getVar( 'emaildisable','','get' );  
		
		JModel::addIncludePath(JPATH_ROOT.'/components/com_jobs/models', 'myjobs');
		$items_job = JModel::getInstance( 'myjobs', 'JobsModel');
		if(strlen($email) >0)	
		$items_job->saveEmailNewsletter($email,$email,$user->firma_navn);
		
		if(strlen($emaildisable) >0)	
		$items_job->removeNewsletter($emaildisable);
		
		
        parent::display($tpl);
    }
}
?>